<?php

class Singleton
{
    private function __construct()
    {
    }

    private static $instance;

    private function __clone()
    {
    }

    public static function getInstance()
    {
        if (!self::$instance instanceof self) {
            $instance = new self();
        }
        return self::$instance;
    }
}

$singleton1 = Singleton::getInstance();
$singleton2 = Singleton::getInstance();
var_dump($singleton1 === $singleton2);
var_dump($singleton1);


